IF OBJECT_ID('ssf.job_get_job_id') IS NOT NULL
	DROP FUNCTION ssf.job_get_job_id
GO

CREATE FUNCTION ssf.job_get_job_id (
	@job_name NVARCHAR(128)
)
RETURNS UNIQUEIDENTIFIER
AS
BEGIN
/*
<object_header>

<object_summary>
	<purpose><![CDATA[
Get id of given job name.
	]]></purpose>
</object_summary>

<parameter_dependency>
	<parameter_name>@job_name</parameter_name>
	<parameter_desc><![CDATA[Name of a job.]]></parameter_desc>
</parameter_dependency>

</object_header>
*/

	RETURN (
		SELECT job_id
		FROM msdb.dbo.sysjobs WITH (NOLOCK)
		WHERE [name] = @job_name
	)
END
GO
